import xml.parsers.expat
import urllib2

# 3 handler functions
def start_element(name, attrs):
    print 'Start element:', name, attrs
def end_element(name):
    print 'End element:', name
def char_data(data):
    print 'Character data:', repr(data)

p = xml.parsers.expat.ParserCreate()

p.StartElementHandler = start_element
p.EndElementHandler = end_element
p.CharacterDataHandler = char_data

d = urllib2.urlopen("http://newsrss.bbc.co.uk/weather/forecast/4197/ObservationsRSS.xml").read()
d = d.replace("\r", "")
d = d.replace("\n", "")

p.Parse(d)
